﻿@model ShoppingCartModel.GiftCardBoxModel
@if (Model.Display)
{
    <div class="giftcard-box">
        <div class="title">
            <strong>@T("ShoppingCart.GiftCardCouponCode")</strong>
        </div>
        <div class="hint">@T("ShoppingCart.GiftCardCouponCode.Tooltip")</div>
        <div class="coupon-code">
            <input name="giftcardcouponcode" id="giftcardcouponcode" type="text" class="gift-card-coupon-code" aria-label="@T("ShoppingCart.GiftCardCouponCode.Label")"/>
            <input type="submit" name="applygiftcardcouponcode" id="applygiftcardcouponcode" 
                   value="@T("ShoppingCart.GiftCardCouponCode.Button")" class="button-2 apply-gift-card-coupon-code-button" />
        </div>
        @if (!string.IsNullOrEmpty(Model.Message))
        {
            <div class="@(Model.IsApplied ? "message-success" : "message-failure")">
                @Model.Message
            </div>
        }
    </div>
    <script asp-location="Footer">
        $(document).ready(function () {
            $('#giftcardcouponcode').on('keydown', function (event) {
                if (event.keyCode == 13) {
                    $('#applygiftcardcouponcode').trigger("click");
                    return false;
                }
            });
        });
    </script>
}